package com.dylearn.serve.impl.rabbitmq;

import com.dylearn.serve.IMassgeService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * 这个 direct 就相当于串联操作
 * */
//@Service
public class RabbitmqDirectImpl implements IMassgeService {

    @Autowired
    AmqpTemplate amqpTemplate;

    @Override
    public void sendMessage(String id) {
        System.out.println("把消息加入消息队列 -- id -> " + id);
        //把数据存放至消息队列
        amqpTemplate.convertAndSend("directExchange","direct",id);
    }

    @Override
    public String doMessage() {
        return null;
    }
}
